//header的悬停事件

var dt_bav_btn12 = document.querySelector("#dt_nav_btn12");
var dt_bav_content12 = document.querySelector("#dt_nav_content12");


dt_bav_btn12.addEventListener("mouseover",function(){
    dt_bav_content12.style.display = "block";
});

dt_bav_btn12.addEventListener("mouseleave",function(){
    dt_bav_content12.style.display = "none";
});

dt_bav_content12.addEventListener("mouseover",function(){
    dt_bav_content12.style.display = "block";
});

dt_bav_content12.addEventListener("mouseleave",function(){
    dt_bav_content12.style.display = "none";
});




var dt_bav_btn13 = document.querySelector("#dt_nav_btn13");
var dt_bav_content13 = document.querySelector("#dt_nav_content13");


dt_bav_btn13.addEventListener("mouseover",function(){
    dt_bav_content13.style.display = "block";
});

dt_bav_btn13.addEventListener("mouseleave",function(){
    dt_bav_content13.style.display = "none";
});

dt_bav_content13.addEventListener("mouseover",function(){
    dt_bav_content13.style.display = "block";
});

dt_bav_content13.addEventListener("mouseleave",function() {
    dt_bav_content13.style.display = "none";

});



//nav的悬停事件
var dt_bav_btn = document.querySelector("#dt_nav_btn");
var dt_bav_content = document.querySelector("#dt_nav_content");


dt_bav_btn.addEventListener("mouseover",function(){
    dt_bav_content.style.display = "block";
});

dt_bav_btn.addEventListener("mouseleave",function(){
    dt_bav_content.style.display = "none";
});

dt_bav_content.addEventListener("mouseover",function(){
    dt_bav_content.style.display = "block";
});

dt_bav_content.addEventListener("mouseleave",function(){
    dt_bav_content.style.display = "none";
});



var dt_bav_btn1 = document.querySelector("#dt_nav_btn1");
var dt_bav_content1 = document.querySelector("#dt_nav_content1");


dt_bav_btn1.addEventListener("mouseover",function(){
    dt_bav_content1.style.display = "block";
});

dt_bav_btn1.addEventListener("mouseleave",function(){
    dt_bav_content1.style.display = "none";
});

dt_bav_content1.addEventListener("mouseover",function(){
    dt_bav_content1.style.display = "block";
});

dt_bav_content1.addEventListener("mouseleave",function(){
    dt_bav_content1.style.display = "none";
});



var dt_bav_btn2 = document.querySelector("#dt_nav_btn2");
var dt_bav_content2 = document.querySelector("#dt_nav_content2");


dt_bav_btn2.addEventListener("mouseover",function(){
    dt_bav_content2.style.display = "block";
});

dt_bav_btn2.addEventListener("mouseleave",function(){
    dt_bav_content2.style.display = "none";
});

dt_bav_content2.addEventListener("mouseover",function(){
    dt_bav_content2.style.display = "block";
});

dt_bav_content2.addEventListener("mouseleave",function(){
    dt_bav_content2.style.display = "none";
});


var dt_bav_btn3 = document.querySelector("#dt_nav_btn3");
var dt_bav_content3 = document.querySelector("#dt_nav_content3");


dt_bav_btn3.addEventListener("mouseover",function(){
    dt_bav_content3.style.display = "block";
});

dt_bav_btn3.addEventListener("mouseleave",function(){
    dt_bav_content3.style.display = "none";
});

dt_bav_content3.addEventListener("mouseover",function(){
    dt_bav_content3.style.display = "block";
});

dt_bav_content3.addEventListener("mouseleave",function(){
    dt_bav_content3.style.display = "none";
});



var dt_bav_btn4 = document.querySelector("#dt_nav_btn4");
var dt_bav_content4 = document.querySelector("#dt_nav_content4");


dt_bav_btn4.addEventListener("mouseover",function(){
    dt_bav_content4.style.display = "block";
});

dt_bav_btn4.addEventListener("mouseleave",function(){
    dt_bav_content4.style.display = "none";
});

dt_bav_content4.addEventListener("mouseover",function(){
    dt_bav_content4.style.display = "block";
});

dt_bav_content4.addEventListener("mouseleave",function(){
    dt_bav_content4.style.display = "none";
});



var dt_bav_btn5 = document.querySelector("#dt_nav_btn5");
var dt_bav_content5 = document.querySelector("#dt_nav_content5");


dt_bav_btn5.addEventListener("mouseover",function(){
    dt_bav_content5.style.display = "block";
});

dt_bav_btn5.addEventListener("mouseleave",function(){
    dt_bav_content5.style.display = "none";
});

dt_bav_content5.addEventListener("mouseover",function(){
    dt_bav_content5.style.display = "block";
});

dt_bav_content5.addEventListener("mouseleave",function(){
    dt_bav_content5.style.display = "none";
});




//main-3悬停事件
var dt_bav_btn6 = document.querySelector("#dt_nav_btn6 p");
var dt_bav_content6 = document.querySelector("#dt_nav_content6");


dt_bav_btn6.addEventListener("mouseover",function(){
    dt_bav_content6.style.display = "block";
});

dt_bav_btn6.addEventListener("mouseleave",function(){
    dt_bav_content6.style.display = "none";
});

dt_bav_content6.addEventListener("mouseover",function(){
    dt_bav_content6.style.display = "block";
});

dt_bav_content6.addEventListener("mouseleave",function(){
    dt_bav_content6.style.display = "none";
});




//main-5的悬停事件
var dt_bav_btn7 = document.querySelector("#dt_nav_btn7");
var dt_bav_content7 = document.querySelector("#dt_nav_content7");


dt_bav_btn7.addEventListener("mouseover",function(){
    dt_bav_content7.style.display = "block";
});

dt_bav_btn7.addEventListener("mouseleave",function(){
    dt_bav_content7.style.display = "none";
});

dt_bav_content7.addEventListener("mouseover",function(){
    dt_bav_content7.style.display = "block";
});

dt_bav_content7.addEventListener("mouseleave",function(){
    dt_bav_content7.style.display = "none";
});




var dt_bav_btn8 = document.querySelector("#dt_nav_btn8");
var dt_bav_content8 = document.querySelector("#dt_nav_content8");


dt_bav_btn8.addEventListener("mouseover",function(){
    dt_bav_content8.style.display = "block";
});

dt_bav_btn8.addEventListener("mouseleave",function(){
    dt_bav_content8.style.display = "none";
});

dt_bav_content8.addEventListener("mouseover",function(){
    dt_bav_content8.style.display = "block";
});

dt_bav_content8.addEventListener("mouseleave",function(){
    dt_bav_content8.style.display = "none";
});



var dt_bav_btn9 = document.querySelector("#dt_nav_btn9");
var dt_bav_content9 = document.querySelector("#dt_nav_content9");


dt_bav_btn9.addEventListener("mouseover",function(){
    dt_bav_content9.style.display = "block";
});

dt_bav_btn9.addEventListener("mouseleave",function(){
    dt_bav_content9.style.display = "none";
});

dt_bav_content9.addEventListener("mouseover",function(){
    dt_bav_content9.style.display = "block";
});

dt_bav_content9.addEventListener("mouseleave",function(){
    dt_bav_content9.style.display = "none";
});





var dt_bav_btn10 = document.querySelector("#dt_nav_btn10");
var dt_bav_content10 = document.querySelector("#dt_nav_content10");


dt_bav_btn10.addEventListener("mouseover",function(){
    dt_bav_content10.style.display = "block";
});

dt_bav_btn10.addEventListener("mouseleave",function(){
    dt_bav_content10.style.display = "none";
});

dt_bav_content10.addEventListener("mouseover",function(){
    dt_bav_content10.style.display = "block";
});

dt_bav_content10.addEventListener("mouseleave",function(){
    dt_bav_content10.style.display = "none";
});




//导航按钮
var b = document.querySelector(".t");
var b1 = document.querySelector(".t1");
var d = document.querySelector(".nav-1");
var d1 = document.querySelector(".nav-1");

    b.addEventListener("click",function(){
        b.style.display="block";
        d.style.display = "block";
        b1.style.display="block";
        b.style.display="none";

    });
    b1.addEventListener("click",function(){
        d1.style.display = "none";
        b.style.display = "block";
        b1.style.display="none";

    });










//banner的轮播
var mySwiper = new Swiper ('#banner #swiper-container', {
    loop: true, // 循环模式选项
    autoplay:true,  //自动播放

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '#banner #swiper-button-next',
        prevEl: '#banner #swiper-button-prev',
    }
});


//main-1的轮播
var swiper = new Swiper('.main-1 .swiper-container', {
    slidesPerView: 5,
    spaceBetween:0,
    freeMode: true,
    navigation: {
        nextEl: '.main-1 .swiper-button-next',
        prevEl: '.main-1 .swiper-button-prev',
    },
});





//main-3的轮播
var mySwiper1 = new Swiper ('.main-3 .swiper-container', {
    loop: true, // 循环模式选项
    autoplay:true,  //自动播放

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '.main-3 .swiper-button-next',
        prevEl: '.main-3 .swiper-button-prev',
    }
});





//main-5的轮播
var swiper = new Swiper('.main-5 .swiper-container', {
    slidesPerView: 6,
    spaceBetween:0,
    freeMode: true,
    navigation: {
        nextEl: '.main-5 .swiper-button-next',
        prevEl: '.main-5 .swiper-button-prev',
    },
});



//Vue数据结构
//定义数据
new Vue ({
    el:"#app",
    data:{
        message :"hello",
    },
    mounted(){
        axios
            .get('json/news.json')
            .then(response => this.message = response.data.fo1)
    .catch(function (error){
            console.log(error);
        })
    }

});



//main-6的轮播

var mySwiper2 = new Swiper ('.main-6 .swiper-container', {
    loop: true, // 循环模式选项
    autoplay:true,  //自动播放
    // 如果需要分页器
    pagination: {
        el: '.main-6 .swiper-pagination',
        clickable :true,
    },

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '.main-6 .swiper-button-next',
        prevEl: '.main-6 .swiper-button-prev',
    },


});



//footer的悬停事件
var dt_bav_btn11 = document.querySelector("#dt_nav_btn11");
var dt_bav_content11 = document.querySelector("#dt_nav_content11");


dt_bav_btn11.addEventListener("mouseover",function(){
    dt_bav_content11.style.display = "block";
});

dt_bav_btn11.addEventListener("mouseleave",function(){
    dt_bav_content11.style.display = "none";
});

dt_bav_content11.addEventListener("mouseover",function(){
    dt_bav_content11.style.display = "block";
});

dt_bav_content11.addEventListener("mouseleave",function(){
    dt_bav_content11.style.display = "none";
});


//返回顶部
var toTop = document.querySelector("#toTop");

window.onscroll = function(){
    console.log(document.documentElement.scrollTop || document.body.scrollTop);
    if(document.documentElement.scrollTop > 100 || document.body.scrollTop){
        toTop.style.display = 'block';
    }else{
        toTop.style.display = 'none';
    }
    toTop.addEventListener('click',function(){
        //window.scrollTo(0,0);

        window.scrollTo({
            top:0,
            behavior:'smooth'

        })
    })

};